/*
 * 文 件    名:  ProductResultModel.java
 * 创建日期:  2012-12-14上午10:28:04
 * 版          权:  Epro Technologies Co., Ltd. Copyright 2011-2012,  All rights reserved
 * 作          者:  hh084
 */
package com.weipu.common.facade.model;

import org.json.JSONObject;

import com.weipu.common.constants.Constant;

/** 
 * @Description 商品返回模型
 * @version [版本号, 2012-12-14]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 * 
 * @author hh084
 */
public class ProductResultModel
{
    private int result;
    
    private int zerosctoe;
    
    private int onescroe;
    
    private int twoscore;
    
    private int threescore;
    
    private int fourscore;
    
    public int getResult()
    {
        return result;
    }
    
    public void setResult(int result)
    {
        this.result = result;
    }
    
    public int getZerosctoe()
    {
        return zerosctoe;
    }
    
    public void setZerosctoe(int zerosctoe)
    {
        this.zerosctoe = zerosctoe;
    }
    
    public int getOnescroe()
    {
        return onescroe;
    }
    
    public void setOnescroe(int onescroe)
    {
        this.onescroe = onescroe;
    }
    
    public int getTwoscore()
    {
        return twoscore;
    }
    
    public void setTwoscore(int twoscore)
    {
        this.twoscore = twoscore;
    }
    
    public int getThreescore()
    {
        return threescore;
    }
    
    public void setThreescore(int threescore)
    {
        this.threescore = threescore;
    }
    
    public int getFourscore()
    {
        return fourscore;
    }
    
    public void setFourscore(int fourscore)
    {
        this.fourscore = fourscore;
    }
    
    /**
     * 产品解析
     * @param json 要解析的产品字符串
     * @return 本地产品对象
     */
    public static ProductResultModel json2product(JSONObject json)
    {
        if (null == json)
        {
            return null;
        }
        
        //产品对象，用来返回的
        ProductResultModel model = new ProductResultModel();
        
        try
        {
            model.setResult(json.optInt(Constant.JSON_RESULT));
            model.setZerosctoe(json.optInt(Constant.JSON_ZEROSCROE));
            model.setOnescroe(json.optInt(Constant.JSON_ONESCROE));
            model.setTwoscore(json.optInt(Constant.JSON_TWOSCROE));
            model.setThreescore(json.optInt(Constant.JSON_THREESCROE));
            model.setFourscore(json.optInt(Constant.JSON_FOURSCROE));
        }
        catch (Exception e)
        {
            //            Logger.w("ProductModel.json2adsModel", e + "");
        }
        return model;
    }
    
}
